package com.seehope.objectstream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;

import javax.xml.stream.events.EndDocument;

public class Demo2 {

	public static void main(String[] args) {
		try {
			InputStream inputStream=new FileInputStream("c:/objectStream.txt");
			ObjectInputStream objectInputStream=new ObjectInputStream(inputStream);
			Person p1=(Person)objectInputStream.readObject();
			System.out.println(p1);
			Person p2=(Person)objectInputStream.readObject();
			System.out.println(p2);
			Person p3=(Person)objectInputStream.readObject();
			System.out.println(p3);
			Person p4=(Person)objectInputStream.readObject();
			System.out.println(p4);
//			Person p5=(Person)objectInputStream.readObject();
//			System.out.println(p5);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
